<?php
/**
 * Created by PhpStorm.
 * User: reshared
 * Date: 2017/10/2
 * Time: 上午11:28
 */

namespace Index\Repository;


use Index\Repository\Tra\InstanceTrait;

class SettingRepository extends BaseRepository
{
    use InstanceTrait;

    public function getOne($key)
    {
        return $this->model('setting')->getById($key);
    }

    public function get($keys = array())
    {
        if (!$keys) {
            $keys = array($keys);
        }
        return $this->model('setting')->getByKeys($keys);
    }

    public function settingFormat($list)
    {
        $result = array();
        foreach ($list as $value) {
            $result[$value['skey']] = $value['svalue'];
        }
        return $result;
    }
}